<script>
	export default {
		onLaunch: function() {
			// 引用tabbar的页面隐藏自带tabbar,不改变四个tabbar的权重
			uni.setStorage({
				key: 'isLoginPage',
				data: false,
			})
			// var that = this
			// uni.getLocation({
			// 	type: 'wgs84',
			// 	success(res) {
			// 		uni.setStorage({
			// 			key: 'store',
			// 			data: {
			// 				lng: res.longitude,
			// 				lat: res.latitude
			// 			},
			// 			success: function() {}
			// 		});
			// 	}
			// });
			uni.hideTabBar()
			console.log('App Launch');
		},
		onShow: function(options) {
			console.log(options)
			if (typeof options?.referrerInfo?.extraData != 'undefined') {
				if (options?.referrerInfo?.extraData?.callbackObj?.from == 'esign') {
					uni.setStorageSync('iszz' , true)
					//如果需要进行跳转的话，可以在这边处理，跳转到自己的小程序某个页面
					if( uni.getStorageSync('flowId') == options.referrerInfo.extraData.callbackObj.flowId ){
						this.$api.agent_signatureUp({
							flowId: options.referrerInfo.extraData.callbackObj.flowId
						}).then(res => {
							console.log(res)
							//#ifdef MP-WEIXIN
							//查看并下载
							wx.downloadFile({ //下载
								url: this.$base.imgUrl + res.data.data, //服务器上的pdf地址
								success(res){
									console.log(res)
									if(res.statusCode == 200){
										console.log("临时下载中", res.tempFilePath)
										uni.saveFile({
											tempFilePath: res.tempFilePath,
											success(res) {
												console.log('正式下载中', res)
												uni.setStorageSync('flowId', ' ')
												uni.openDocument({
													filePath: res.savedFilePath,
													success(res) {
														console.log('打开文档')
													}
												})
											},
											fail(err) {
												console.log(err , '下载失败')
											}
										})
									}
								},
								fail(err) {
									console.log(err , '下载失败')
								}
							})
							//#endif
						})
					}
				}
			}

			console.log('App Show');
		},
		onHide: function() {
			console.log('App Hide');
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	// 全局引入uview样式,必须在第一行
	@import "uview-ui/index.scss";

	page {
		background-color: #F5F5F5;
	}

	/* #ifndef APP-NVUE */
	* {
		box-sizing: border-box;
	}

	text {
		display: block;
	}

	.btn_none {
		width: auto;
		height: auto;
		padding: 0;
		margin: 0;
		background-color: #FFF0;
		border: 0rpx;
	}

	.btn_none::after {
		border: none;
	}


	.nextStep {
		// margin: 100rpx auto;
		width: 100vw;
		position: fixed;
		left: 0px;
		height: calc(120rpx + constant(safe-area-inset-bottom));
		height: calc(120rpx + env(safe-area-inset-bottom));
		bottom: 0rpx;

		.nextStepBtn {
			color: #FFFFFF;
			text-align: center;
			line-height: 88rpx;
			font-weight: 500;
			font-size: 32rpx;
			background-color: #41967C;
			width: 90vw;
			border-radius: 44rpx;
			height: 88rpx;
			margin: 0px auto;
			margin-top: 16rpx;
		}
	}



	/* #endif */

	// 全局felx盒子定位
	.flex-r-s-c {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: row !important;
		justify-content: flex-start !important;
		align-items: center !important;
	}

	.flex-r-s-e {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: row !important;
		justify-content: flex-start !important;
		align-items: flex-end !important;
	}

	.flex-r-b-e {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: row !important;
		justify-content: flex-end !important;
		align-items: center !important;
	}

	.flex-r-a-c {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: row !important;
		justify-content: space-around !important;
		align-items: center !important;
	}

	.flex-r-b-c {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: row !important;
		justify-content: space-between !important;
		align-items: center !important;
	}

	.flex-r-c-c {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: row !important;
		justify-content: center !important;
		align-items: center !important;
	}

	.flex-r-s-s {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: row !important;
		justify-content: flex-start !important;
		align-items: flex-start !important;
	}

	.flex-r-a-s {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: row !important;
		justify-content: space-around !important;
		align-items: flex-start !important;
	}

	.flex-r-b-s {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: row !important;
		justify-content: space-between !important;
		align-items: flex-start !important;
	}

	.flex-r-c-s {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: row !important;
		justify-content: center !important;
		align-items: flex-start !important;
	}

	.flex-c-s-c {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: column !important;
		justify-content: flex-start !important;
		align-items: center !important;
	}

	.flex-c-c-e {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: column !important;
		justify-content: center !important;
		align-items: flex-end !important;
	}

	.flex-cr-s-c {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: column-reverse !important;
		justify-content: flex-start !important;
		align-items: center !important;
	}

	.flex-c-a-c {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: column !important;
		justify-content: space-around !important;
		align-items: center !important;
	}

	.flex-c-b-c {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: column !important;
		justify-content: space-between !important;
		align-items: center !important;
	}

	.flex-c-b-e {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: column !important;
		justify-content: space-between !important;
		align-items: flex-end !important;
	}

	.flex-c-c-c {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: column !important;
		justify-content: center !important;
		align-items: center !important;
	}

	.flex-c-s-s {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: column !important;
		justify-content: flex-start !important;
		align-items: flex-start !important;
	}

	.flex-c-a-s {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: column !important;
		justify-content: space-around !important;
		align-items: flex-start !important;
	}

	.flex-c-b-s {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: column !important;
		justify-content: space-between !important;
		align-items: flex-start !important;
	}

	.flex-r-e-b {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: row !important;
		justify-content: flex-end !important;
		align-items: baseline !important;
	}

	.flex-c-c-s {
		/* #ifndef APP-NVUE */
		display: flex !important;
		/* #endif */
		flex-direction: column !important;
		justify-content: center !important;
		align-items: flex-start !important;
	}

	// 字体单行超出隐显示3个点
	.one-line-ellipsis {
		overflow: hidden;
		text-overflow: ellipsis;
		/* #ifndef APP-NVUE */
		word-wrap: anywhere;
		/* #endif */
	}

	/* #ifdef APP-NVUE */
	.one-line-ellipsis {
		lines: 1;
	}

	/* #endif */

	/* #ifndef APP-NVUE */
	.one-line-ellipsis {
		white-space: nowrap;
	}

	/* #endif */
	// 字体双行超出隐显示3个点
	.two-line-ellipsis {
		overflow: hidden;
		text-overflow: ellipsis;
		/* #ifndef APP-NVUE */
		word-wrap: anywhere;
		/* #endif */

	}

	/* #ifdef APP-NVUE */
	.two-line-ellipsis {
		lines: 2;
	}

	/* #endif */

	/* #ifndef APP-NVUE */
	.two-line-ellipsis {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	/* #endif */
</style>
